<?php
/**
 * @category 	Dao.php
 * @author 	Sung Hoon, Cho (akdddnet@gmail.com)
 * @since		2011. 10. 4.
 * @license		BSD License
 * @version		0.1
 */


global $CFG;
require_once $CFG->FW_DIR."/mvc/Dao.php";

class BaseDao extends Dao {

	function __construct(array $db_type = null) {
		parent::__construct($db_type);
	}
	
	
	function getMenu(DTO $dto) {
			
		$query = "
	 					SELECT 
	 								*
	 					FROM		menu
	 					WHERE		1 = 1
	 					AND			mn_admin >= :level
	 					ORDER BY mn_order
	 	";
		
		// 로그인이 안되어 있다면 아무 메뉴도 표시 안되게 2값을 설정.
		$level = (Common::isNullOrEmpty($_SESSION['owner'])) ? 2 : $_SESSION['owner']->m_level;
		$param = array('level'=>$level);
			
		$dto->list = $this->db->query($query, $param)->fetchAll();
			
		return $dto;
	}
	
}